package com.softserve.academy.food.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.softserve.academy.food.entity.OrderContents;
import com.softserve.academy.food.entity.OrderInfo;

public class OrderModel
{
	private int					id;
	private UserModel			userModel;
	private Date				date;
	private Character			status;
	private List<ContentModel>	spec;

	public OrderModel()
	{
	}

	@Override
	public String toString()
	{
		return "User: " + userModel.getId() + " Date: " + date + " Status: "
				+ status + " Content: " + spec.toString();
	}

	public OrderModel(int id, UserModel userModel, Date date, Character status,
			List<ContentModel> spec)
	{
		this.id = id;
		this.userModel = userModel;
		this.date = date;
		this.status = status;
		this.spec = spec;
	}

	public OrderInfo toEntity()
	{
		List<OrderContents> cmod = new ArrayList<OrderContents>();
		for (ContentModel c : spec)
		{
			cmod.add(c.toEntity());
		}
		return new OrderInfo(userModel.toEntity(), date, status, cmod);
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public UserModel getUserModel()
	{
		return userModel;
	}

	public void setUserModel(UserModel userModel)
	{
		this.userModel = userModel;
	}

	public Date getDate()
	{
		return date;
	}

	public void setDate(Date date)
	{
		this.date = date;
	}

	public Character getStatus()
	{
		return status;
	}

	public void setStatus(Character status)
	{
		this.status = status;
	}

	public List<ContentModel> getSpec()
	{
		return spec;
	}

	public void setSpec(List<ContentModel> spec)
	{
		this.spec = spec;
	}
}
